import { BaseController, CoolController } from "@cool-midway/core";
import { ProviderTeamService } from "../../service/team";
import { ProviderTeamEntity } from "../../entity/team";
import { Body, Inject, Post } from "@midwayjs/core";

@CoolController({
    api: ['add'],
    service: ProviderTeamService,
    entity: ProviderTeamEntity,
})
export class ProviderTeamController extends BaseController {

    @Inject()
    providerTeamService: ProviderTeamService

    @Post('/getCurrentTeamInviteCode', { summary: '生成团队邀请码' })
    async getCurrentTeamInviteCode() {
        return this.ok(await this.providerTeamService.getCurrentTeamInviteCode());
    }

    @Post('/getByInviteCode', { summary: '根据团队邀请码查询团队' })
    async getByInviteCode(@Body() body: { inviteCode: string }) {
        return this.ok(await this.providerTeamService.getByInviteCode(body.inviteCode));
    }


}